import { post, get } from '@/utils/request'

// 用户注册
export const registerAPI = (data) => {
  return post('/api/auth/register', {
    username: data.username,
    email: data.email,
    password: data.password,
    nickname: data.nickname
  })
}

// 用户登录
export const loginAPI = (data) => {
  return post('/api/auth/login', {
    username: data.username,
    password: data.password
  })
}

// 微信小程序授权登录
export const wechatLoginAPI = (code) => {
  return post('/api/auth/wechat-login', {
    code: code,
    platform: 'miniprogram'
  })
}

// Token刷新
export const refreshTokenAPI = (refreshToken) => {
  return post('/api/auth/refresh', {
    refreshToken: refreshToken
  })
}

// 获取验证码
export const getVerifyCodeAPI = (phone) => {
  return post('/api/auth/verify-code', {
    phone: phone
  })
}

// 验证验证码
export const verifyCodeAPI = (phone, code) => {
  return post('/api/auth/verify', {
    phone: phone,
    code: code
  })
}

// 重置密码
export const resetPasswordAPI = (data) => {
  return post('/api/auth/reset-password', {
    phone: data.phone,
    code: data.code,
    password: data.password
  })
} 